<template lang="">
	<view
		class="good-bar"
	>
		<!-- 商品卡片的图片与标题部分,下架则显示下架的图片 -->
		<image
			:src="[goodsInfo.offShelf ? 'https://skillgo.cn/image/image/unshirt.png' : 'https://skillgo.cn/chargePics/' + goodsInfo.picture] "
			class="image"
			mode="widthFix"
		/>
		<view class="good-info">
			<view class="title">
				<text>{{goodsInfo.title.length>20?goodsInfo.title.substr(0,20)+"...":goodsInfo.title}}</text>
			</view>
			<!-- 商品卡片的底部标题栏插槽 -->
			<slot>
				<view class="user-info">
					<u-avatar
						:src="goodsInfo.skin || 'https://img.ixintu.com/download/jpg/20200716/bde64019d277e8e4f32a80f72894764d_512_512.jpg!con'"
						size="50rpx"
					/>
					<text class="text">{{goodsInfo.name }}</text>
					<view class="price"><text>￥{{goodsInfo.price}}</text></view>
				</view>
			</slot>
		</view>
	</view>
</template>
<script>
export default {
  props: {
    // 传入的商品属性，使用属性见template
    goodsInfo: {
      type: Object,

    }
  },
  created() {},
  computed: {
    // 计算是否下架
    shirt() {
      return !this.goodsInfo.offShelf ? 'https://skillgo.cn/image/image/unshirt.png' : 'https://skillgo.cn/chargePics/' + this.goodsInfo.picture
    }
  },
  data() {
    return {

    }
  },
}
</script>
<style lang="scss">

	.good-bar {
		background-color: #ffffff;
		border-radius: 16rpx;
		margin-bottom: 24rpx;
		.image {
			width: 100%;
			border-radius: 16rpx 16rpx 0 0;
		}
		.good-info {
			padding: 20rpx;
			.title {
				font-size: 32rpx;
				font-weight: 700;
				color: #000000;
				text-align: left;
				text {
					word-break:break-all;
					white-space: pre-wrap;
				}

			}
		}
		.user-info {
			display: flex;
			flex-direction: row;
			justify-content: space-around;
			align-items: center;
			padding-top: 10rpx;
			.text {
				margin-left: 16rpx;
				margin-right: 16rpx;
				color: #797979;
				font-size: 24rpx;
				max-width: 130rpx;
				text-overflow: ellipsis;
				overflow: hidden;
				white-space: nowrap;
			}
			.price {
				height: 40rpx;
				width: 100rpx;
				background-color: #3A62E9;
				color: #ffffff;
				font-size: 24rpx;
				border-radius: 8rpx;
				text-align: center;
				line-height: 40rpx;
			}
		}

	}

</style>
